<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c"%>
<%
	String path = request.getContextPath();
%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
 <meta name="renderer" content="webkit">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>客户自有运营车辆信息</title>
<jsp:include page="../../import.jsp" flush="true" />
</head>
<body>
		<form id="prj_cst_own_vehicle_form">
             <div class="fieldset1 tabel_col tabel_col_s clearFix noBorder">
               <div class="fieldBox col_50">
                    <div class="label">购买时间</div>
                    <div class="field">
                        <input name="buyDt" id="buyDt"  type="text"  class="ui-datepicker" value="${vehicle.buyDt}" >
                    </div>
                </div>
               <div class="fieldBox col_50" >
                    <div class="label">品牌</div>
                    <div class="field">
                        <input name="brNm" id="brNm" type="text" class="ui-textbox" value="${vehicle.brNm}" >
                    </div>
                </div>
                <div class="fieldBox col_50">
                    <div class="label">数量</div>
                    <div class="field">
                        <input name="qty" id="qty" type="text" class="ui-textbox" value="${vehicle.qty}" validate="{digits:true}">
                    </div>
                </div>
                    <div class="fieldBox col_50">
                    <div class="label">购买价格（万元）</div>
                    <div class="field">
                        <input name="buyPrc" id="buyPrc" type="text" class="ui-textbox" value="${vehicle.buyPrc}" data-tofix="2"  validate="{number: true}">
                    </div>
                </div>
                <div class="fieldBox col_50" >
                    <div class="label">贷款余额（万元)</div>
                    <div class="field">
                        <input name="loanBlc" id="loanBlc" type="text" class="ui-textbox" value="${vehicle.loanBlc}"  data-tofix="2" validate="{number: true}">
                    </div>
                </div>
                
                <div class="fieldBox col_50">
                    <div class="label"> 运载吨位</div>
                    <div class="field">
                        <input name="cryTng" id="cryTng"  class="ui-textbox" type="text" value="${vehicle.cryTng}">
                    </div>
                </div>
                  <div class="fieldBox col_50">
                    <div class="label"> 客车载客数（仅客车）</div>
                    <div class="field">
                        <input name="psgNum" id="psgNum" type="text" class="ui-textbox" value="${vehicle.psgNum}" validate="{digits:true}">
                    </div>
                </div>
            </div>
            <!-- hide data -->
	        <div class="fieldBox col_100" style="display:none;">
	          <div class="field">
	              <input name="vehicleId"  id="vehicleId" type="text" class="ui-textbox" value="${vehicle.id}">
	          </div>
	        </div>
            <div class="btnsBox">
                <span id="prj_cst_own_vehicle_form_add_btn_id" class="sq-button sq-button-round"><!-- <i class="sqBtnIco_10"></i> -->保存</span>
                <span id="prj_cst_own_vehicle_form_cancel_btn_id" class="sq-button sq-button-round"><!-- <i class="sqBtnIco_14"></i> -->取消</span>
            </div>
        </form>
	<script>
	var prjId ='${prjId}';
	var cstId ='${cstId}';
		$(function() {
			
		   var buyDt = $("#buyDt").val();
		   $("#prj_cst_own_vehicle_form").ligerForm({
                validate: true
           });
		
			if(null != buyDt&&buyDt!=''){
				var date = new Date(buyDt);
				$("#buyDt").val(DateUtils.formatDate(date, DateUtils.YYYY_MM_DD));
			}
	        $("#prj_cst_own_vehicle_form_add_btn_id").click(function(event) {
	            var ligerForm = liger.get("prj_cst_own_vehicle_form");
	            if (!ligerForm.valid()) {
	                top.$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO,SQ_type: "warning"});
	                return false; //验证不通过，不执行以下代码
	            }
	            var data = ligerForm.getData();
	            data["buyDt"] = $("#buyDt").val();
	            var url = '<%=path%>/project/prjcstownvehicle/add.do';
	            data["id"]= $("#vehicleId").val();
	            data["prjId"] =prjId;
	            data["cstId"]= cstId;
	            var wait_dialog;
	            $.ajax({
	        		type: 'post',
	        		dataType:'json',
	        		data:data,
	        		url: url,
	        		beforeSend: function(){
	  		          wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
	  		     },
	        		success:function(msg){
	        			 wait_dialog.close();
	        			 if(msg.success == 1){
	        				 top.$.ligerDialog.SQalert({content: msg.info,SQ_type: "success"});
	        				 parent.grid.reload();
	        				 frameElement.dialog.close();
	        			 }else{
	        				 top.$.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
	        			 }
	        		}
	        	});
	        });
	        
	        //取消
	        $("#prj_cst_own_vehicle_form_cancel_btn_id").click(function(event) {
	        	frameElement.dialog.close();
	        });
	        
		});
		
	</script>

</body>
</html>